home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / mario.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  18KB  |  600 lines

  1. /***************************************************************************
  2.  
  3. Mario Bros memory map (preliminary):
  4.  
  5. driver by Mirko Buffoni
  6.  
  7.  
  8. 0000-5fff ROM
  9. 6000-6fff RAM
  10. 7000-73ff ?
  11. 7400-77ff Video RAM
  12. f000-ffff ROM
  13.  
  14. read:
  15. 7c00      IN0
  16. 7c80      IN1
  17. 7f80      DSW
  18.  
  19. *
  20.  * IN0 (bits NOT inverted)
  21.  * bit 7 : TEST
  22.  * bit 6 : START 2
  23.  * bit 5 : START 1
  24.  * bit 4 : JUMP player 1
  25.  * bit 3 : ? DOWN player 1 ?
  26.  * bit 2 : ? UP player 1 ?
  27.  * bit 1 : LEFT player 1
  28.  * bit 0 : RIGHT player 1
  29.  *
  30. *
  31.  * IN1 (bits NOT inverted)
  32.  * bit 7 : ?
  33.  * bit 6 : COIN 2
  34.  * bit 5 : COIN 1
  35.  * bit 4 : JUMP player 2
  36.  * bit 3 : ? DOWN player 2 ?
  37.  * bit 2 : ? UP player 2 ?
  38.  * bit 1 : LEFT player 2
  39.  * bit 0 : RIGHT player 2
  40.  *
  41. *
  42.  * DSW (bits NOT inverted)
  43.  * bit 7 : \ difficulty
  44.  * bit 6 : / 00 = easy  01 = medium  10 = hard  11 = hardest
  45.  * bit 5 : \ bonus
  46.  * bit 4 : / 00 = 20000  01 = 30000  10 = 40000  11 = none
  47.  * bit 3 : \ coins per play
  48.  * bit 2 : /
  49.  * bit 1 : \ 00 = 3 lives  01 = 4 lives
  50.  * bit 0 : / 10 = 5 lives  11 = 6 lives
  51.  *
  52.  
  53. write:
  54. 7d00      vertical scroll (pow)
  55. 7d80      ?
  56. 7e00      sound
  57. 7e80-7e82 ?
  58. 7e83      sprite palette bank select
  59. 7e84      interrupt enable
  60. 7e85      ?
  61. 7f00-7f07 sound triggers
  62.  
  63.  
  64. I/O ports
  65.  
  66. write:
  67. 00        ?
  68.  
  69. ***************************************************************************/
  70.  
  71. #include "driver.h"
  72. #include "vidhrdw/generic.h"
  73. #include "cpu/i8039/i8039.h"
  74.  
  75. static int p[8] = { 0,0xf0,0,0,0,0,0,0 };
  76. static int t[2] = { 0,0 };
  77.  
  78.  
  79. extern unsigned char *mario_scrolly;
  80.  
  81. WRITE_HANDLER( mario_gfxbank_w );
  82. WRITE_HANDLER( mario_palettebank_w );
  83. int  mario_vh_start(void);
  84. void mario_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  85. void mario_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  86.  
  87. /*
  88.  *  from sndhrdw/mario.c
  89.  */
  90. WRITE_HANDLER( mario_sh_w );
  91. WRITE_HANDLER( mario_sh1_w );
  92. WRITE_HANDLER( mario_sh2_w );
  93. WRITE_HANDLER( mario_sh3_w );
  94.  
  95.  
  96. #define ACTIVELOW_PORT_BIT(P,A,D)   ((P & (~(1 << A))) | ((D ^ 1) << A))
  97. #define ACTIVEHIGH_PORT_BIT(P,A,D)   ((P & (~(1 << A))) | (D << A))
  98.  
  99.  
  100. WRITE_HANDLER( mario_sh_getcoin_w )    { t[0] = data; }
  101. WRITE_HANDLER( mario_sh_crab_w )       { p[1] = ACTIVEHIGH_PORT_BIT(p[1],0,data); }
  102. WRITE_HANDLER( mario_sh_turtle_w )     { p[1] = ACTIVEHIGH_PORT_BIT(p[1],1,data); }
  103. WRITE_HANDLER( mario_sh_fly_w )        { p[1] = ACTIVEHIGH_PORT_BIT(p[1],2,data); }
  104. static WRITE_HANDLER( mario_sh_tuneselect_w ) { soundlatch_w(offset,data); }
  105.  
  106. static READ_HANDLER( mario_sh_p1_r )   { return p[1]; }
  107. static READ_HANDLER( mario_sh_p2_r )   { return p[2]; }
  108. static READ_HANDLER( mario_sh_t0_r )   { return t[0]; }
  109. static READ_HANDLER( mario_sh_t1_r )   { return t[1]; }
  110. static READ_HANDLER( mario_sh_tune_r ) { return soundlatch_r(offset); }
  111.  
  112. static WRITE_HANDLER( mario_sh_sound_w )
  113. {
  114.     DAC_data_w(0,data);
  115. }
  116. static WRITE_HANDLER( mario_sh_p1_w )
  117. {
  118.     p[1] = data;
  119. }
  120. static WRITE_HANDLER( mario_sh_p2_w )
  121. {
  122.     p[2] = data;
  123. }
  124. WRITE_HANDLER( masao_sh_irqtrigger_w )
  125. {
  126.     static int last;
  127.  
  128.  
  129.     if (last == 1 && data == 0)
  130.     {
  131.         /* setting bit 0 high then low triggers IRQ on the sound CPU */
  132.         cpu_cause_interrupt(1,0xff);
  133.     }
  134.  
  135.     last = data;
  136. }
  137.  
  138. static struct MemoryReadAddress readmem[] =
  139. {
  140.     { 0x0000, 0x5fff, MRA_ROM },
  141.     { 0x6000, 0x6fff, MRA_RAM },
  142.     { 0x7400, 0x77ff, MRA_RAM },    /* video RAM */
  143.     { 0x7c00, 0x7c00, input_port_0_r },    /* IN0 */
  144.     { 0x7c80, 0x7c80, input_port_1_r },    /* IN1 */
  145.     { 0x7f80, 0x7f80, input_port_2_r },    /* DSW */
  146.     { 0xf000, 0xffff, MRA_ROM },
  147.     { -1 }    /* end of table */
  148. };
  149.  
  150.  
  151. static struct MemoryWriteAddress writemem[] =
  152. {
  153.     { 0x0000, 0x5fff, MWA_ROM },
  154.     { 0x6000, 0x68ff, MWA_RAM },
  155.     { 0x6a80, 0x6fff, MWA_RAM },
  156.     { 0x6900, 0x6a7f, MWA_RAM, &spriteram, &spriteram_size },
  157.     { 0x7400, 0x77ff, videoram_w, &videoram, &videoram_size },
  158.     { 0x7c00, 0x7c00, mario_sh1_w }, /* Mario run sample */
  159.     { 0x7c80, 0x7c80, mario_sh2_w }, /* Luigi run sample */
  160.     { 0x7d00, 0x7d00, MWA_RAM, &mario_scrolly },
  161.     { 0x7e80, 0x7e80, mario_gfxbank_w },
  162.     { 0x7e83, 0x7e83, mario_palettebank_w },
  163.     { 0x7e84, 0x7e84, interrupt_enable_w },
  164.     { 0x7f00, 0x7f00, mario_sh_w },    /* death */
  165.     { 0x7f01, 0x7f01, mario_sh_getcoin_w },
  166.     { 0x7f03, 0x7f03, mario_sh_crab_w },
  167.     { 0x7f04, 0x7f04, mario_sh_turtle_w },
  168.     { 0x7f05, 0x7f05, mario_sh_fly_w },
  169.     { 0x7f00, 0x7f07, mario_sh3_w }, /* Misc discrete samples */
  170.     { 0x7e00, 0x7e00, mario_sh_tuneselect_w },
  171.     { 0x7000, 0x73ff, MWA_NOP },    /* ??? */
  172. //    { 0x7e85, 0x7e85, MWA_RAM },    /* Sets alternative 1 and 0 */
  173.     { 0xf000, 0xffff, MWA_ROM },
  174.     { -1 }    /* end of table */
  175. };
  176.  
  177. static struct MemoryWriteAddress masao_writemem[] =
  178. {
  179.     { 0x0000, 0x5fff, MWA_ROM },
  180.     { 0x6000, 0x68ff, MWA_RAM },
  181.     { 0x6a80, 0x6fff, MWA_RAM },
  182.     { 0x6900, 0x6a7f, MWA_RAM, &spriteram, &spriteram_size },
  183.     { 0x7400, 0x77ff, videoram_w, &videoram, &videoram_size },
  184.     { 0x7d00, 0x7d00, MWA_RAM, &mario_scrolly },
  185.     { 0x7e00, 0x7e00, soundlatch_w },
  186.     { 0x7e80, 0x7e80, mario_gfxbank_w },
  187.     { 0x7e83, 0x7e83, mario_palettebank_w },
  188.     { 0x7e84, 0x7e84, interrupt_enable_w },
  189.     { 0x7000, 0x73ff, MWA_NOP },    /* ??? */
  190.     { 0x7f00, 0x7f00, masao_sh_irqtrigger_w },
  191.     { 0xf000, 0xffff, MWA_ROM },
  192.     { -1 }    /* end of table */
  193. };
  194.  
  195. static struct IOWritePort mario_writeport[] =
  196. {
  197.     { 0x00,   0x00,   IOWP_NOP },  /* unknown... is this a trigger? */
  198.     { -1 }    /* end of table */
  199. };
  200.  
  201. static struct MemoryReadAddress readmem_sound[] =
  202. {
  203.     { 0x0000, 0x0fff, MRA_ROM },
  204.     { -1 }    /* end of table */
  205. };
  206. static struct MemoryWriteAddress writemem_sound[] =
  207. {
  208.     { 0x0000, 0x0fff, MWA_ROM },
  209.     { -1 }    /* end of table */
  210. };
  211. static struct IOReadPort readport_sound[] =
  212. {
  213.     { 0x00,     0xff,     mario_sh_tune_r },
  214.     { I8039_p1, I8039_p1, mario_sh_p1_r },
  215.     { I8039_p2, I8039_p2, mario_sh_p2_r },
  216.     { I8039_t0, I8039_t0, mario_sh_t0_r },
  217.     { I8039_t1, I8039_t1, mario_sh_t1_r },
  218.     { -1 }    /* end of table */
  219. };
  220. static struct IOWritePort writeport_sound[] =
  221. {
  222.     { 0x00,     0xff,     mario_sh_sound_w },
  223.     { I8039_p1, I8039_p1, mario_sh_p1_w },
  224.     { I8039_p2, I8039_p2, mario_sh_p2_w },
  225.     { -1 }    /* end of table */
  226. };
  227.  
  228.  
  229.  
  230. INPUT_PORTS_START( mario )
  231.     PORT_START      /* IN0 */
  232.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  233.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY )
  234.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  235.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  236.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  237.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
  238.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
  239.     PORT_BITX(0x80, IP_ACTIVE_HIGH, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  240.  
  241.     PORT_START      /* IN1 */
  242.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 )
  243.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 )
  244.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  245.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  246.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
  247.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
  248.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
  249.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  250.  
  251.     PORT_START      /* DSW0 */
  252.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  253.     PORT_DIPSETTING(    0x00, "3" )
  254.     PORT_DIPSETTING(    0x01, "4" )
  255.     PORT_DIPSETTING(    0x02, "5" )
  256.     PORT_DIPSETTING(    0x03, "6" )
  257.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) )
  258.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  259.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  260.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  261.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_3C ) )
  262.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
  263.     PORT_DIPSETTING(    0x00, "20000" )
  264.     PORT_DIPSETTING(    0x10, "30000" )
  265.     PORT_DIPSETTING(    0x20, "40000" )
  266.     PORT_DIPSETTING(    0x30, "None" )
  267.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) )
  268.     PORT_DIPSETTING(    0x00, "Easy" )
  269.     PORT_DIPSETTING(    0x40, "Medium" )
  270.     PORT_DIPSETTING(    0x80, "Hard" )
  271.     PORT_DIPSETTING(    0xc0, "Hardest" )
  272. INPUT_PORTS_END
  273.  
  274. INPUT_PORTS_START( mariojp )
  275.     PORT_START      /* IN0 */
  276.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  277.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY )
  278.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  279.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  280.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  281.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
  282.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
  283.     PORT_BITX(0x80, IP_ACTIVE_HIGH, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  284.  
  285.     PORT_START      /* IN1 */
  286.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 )
  287.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 )
  288.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  289.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  290.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
  291.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
  292.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )    /* doesn't work in game, but does in service mode */
  293.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  294.  
  295.     PORT_START      /* DSW0 */
  296.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  297.     PORT_DIPSETTING(    0x00, "3" )
  298.     PORT_DIPSETTING(    0x01, "4" )
  299.     PORT_DIPSETTING(    0x02, "5" )
  300.     PORT_DIPSETTING(    0x03, "6" )
  301.     PORT_DIPNAME( 0x1c, 0x00, DEF_STR( Coinage ) )
  302.     PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
  303.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  304.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  305.     PORT_DIPSETTING(    0x18, DEF_STR( 1C_2C ) )
  306.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  307.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  308.     PORT_DIPSETTING(    0x14, DEF_STR( 1C_5C ) )
  309.     PORT_DIPSETTING(    0x1c, DEF_STR( 1C_6C ) )
  310.     PORT_DIPNAME( 0x20, 0x20, "2 Players Game" )
  311.     PORT_DIPSETTING(    0x00, "1 Credit" )
  312.     PORT_DIPSETTING(    0x20, "2 Credits" )
  313.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Bonus_Life ) )
  314.     PORT_DIPSETTING(    0x00, "20000" )
  315.     PORT_DIPSETTING(    0x40, "30000" )
  316.     PORT_DIPSETTING(    0x80, "40000" )
  317.     PORT_DIPSETTING(    0xc0, "None" )
  318. INPUT_PORTS_END
  319.  
  320.  
  321.  
  322. static struct GfxLayout charlayout =
  323. {
  324.     8,8,    /* 8*8 characters */
  325.     512,    /* 512 characters */
  326.     2,    /* 2 bits per pixel */
  327.     { 512*8*8, 0 },    /* the bitplanes are separated */
  328.     { 0, 1, 2, 3, 4, 5, 6, 7 },    /* pretty straightforward layout */
  329.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  330.     8*8    /* every char takes 8 consecutive bytes */
  331. };
  332.  
  333.  
  334. static struct GfxLayout spritelayout =
  335. {
  336.     16,16,    /* 16*16 sprites */
  337.     256,    /* 256 sprites */
  338.     3,    /* 3 bits per pixel */
  339.     { 2*256*16*16, 256*16*16, 0 },    /* the bitplanes are separated */
  340.     { 0, 1, 2, 3, 4, 5, 6, 7,        /* the two halves of the sprite are separated */
  341.             256*16*8+0, 256*16*8+1, 256*16*8+2, 256*16*8+3, 256*16*8+4, 256*16*8+5, 256*16*8+6, 256*16*8+7 },
  342.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  343.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  344.     16*8    /* every sprite takes 16 consecutive bytes */
  345. };
  346.  
  347.  
  348.  
  349. static struct GfxDecodeInfo gfxdecodeinfo[] =
  350. {
  351.     { REGION_GFX1, 0, &charlayout,      0, 16 },
  352.     { REGION_GFX2, 0, &spritelayout, 16*4, 32 },
  353.     { -1 } /* end of array */
  354. };
  355.  
  356.  
  357.  
  358. static struct DACinterface dac_interface =
  359. {
  360.     1,
  361.     { 100 }
  362. };
  363.  
  364. static const char *mario_sample_names[] =
  365. {
  366.     "*mario",
  367.  
  368.     /* 7f01 - 7f07 sounds */
  369.     "ice.wav",    /* 0x02 ice appears (formerly effect0.wav) */
  370.     "coin.wav",   /* 0x06 coin appears (formerly effect1.wav) */
  371.     "skid.wav",   /* 0x07 skid */
  372.  
  373.     /* 7c00 */
  374.     "run.wav",        /* 03, 02, 01 - 0x1b */
  375.  
  376.     /* 7c80 */
  377.     "luigirun.wav",   /* 03, 02, 01 - 0x1c */
  378.  
  379.     0    /* end of array */
  380. };
  381.  
  382. static struct Samplesinterface samples_interface =
  383. {
  384.     3,    /* 3 channels */
  385.     25,    /* volume */
  386.     mario_sample_names
  387. };
  388.  
  389. static struct AY8910interface ay8910_interface =
  390. {
  391.     1,      /* 1 chip */
  392.     14318000/6,    /* ? */
  393.     { 50 },
  394.     { soundlatch_r },
  395.     { 0 },
  396.     { 0 },
  397.     { 0 }
  398. };
  399.  
  400. static struct MemoryReadAddress masao_sound_readmem[] =
  401. {
  402.     { 0x0000, 0x0fff, MRA_ROM },
  403.     { 0x2000, 0x23ff, MRA_RAM },
  404.     { 0x4000, 0x4000, AY8910_read_port_0_r },
  405.     { -1 }  /* end of table */
  406. };
  407.  
  408. static struct MemoryWriteAddress masao_sound_writemem[] =
  409. {
  410.     { 0x0000, 0x0fff, MWA_ROM },
  411.     { 0x2000, 0x23ff, MWA_RAM },
  412.     { 0x6000, 0x6000, AY8910_control_port_0_w },
  413.     { 0x4000, 0x4000, AY8910_write_port_0_w },
  414.     { -1 }  /* end of table */
  415. };
  416.  
  417.  
  418. static struct MachineDriver machine_driver_mario =
  419. {
  420.     /* basic machine hardware */
  421.     {
  422.         {
  423.             CPU_Z80,
  424.             3072000,    /* 3.072 Mhz (?) */
  425.             readmem,writemem,0,mario_writeport,
  426.             nmi_interrupt,1
  427.         },
  428.         {
  429.             CPU_I8039 | CPU_AUDIO_CPU,
  430.                         730000,         /* 730 khz */
  431.             readmem_sound,writemem_sound,readport_sound,writeport_sound,
  432.             ignore_interrupt,1
  433.         }
  434.     },
  435.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  436.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  437.     0,
  438.  
  439.     /* video hardware */
  440.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  441.     gfxdecodeinfo,
  442.     256,16*4+32*8,
  443.     mario_vh_convert_color_prom,
  444.  
  445.     VIDEO_TYPE_RASTER,
  446.     0,
  447.     generic_vh_start,
  448.     generic_vh_stop,
  449.     mario_vh_screenrefresh,
  450.  
  451.     /* sound hardware */
  452.     0,0,0,0,
  453.     {
  454.         {
  455.             SOUND_DAC,
  456.             &dac_interface
  457.         },
  458.         {
  459.             SOUND_SAMPLES,
  460.             &samples_interface
  461.         }
  462.     }
  463. };
  464.  
  465. static struct MachineDriver machine_driver_masao =
  466. {
  467.     /* basic machine hardware */
  468.     {
  469.         {
  470.             CPU_Z80,
  471.             4000000,        /* 4.000 Mhz (?) */
  472.             readmem,masao_writemem,0,0,
  473.             nmi_interrupt,1
  474.         },
  475.         {
  476.             CPU_Z80 | CPU_AUDIO_CPU,
  477.             24576000/16,    /* ???? */
  478.             masao_sound_readmem,masao_sound_writemem,0,0,
  479.             ignore_interrupt,1
  480.         }
  481.  
  482.         },
  483.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  484.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  485.     0,
  486.  
  487.     /* video hardware */
  488.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  489.     gfxdecodeinfo,
  490.     256,16*4+32*8,
  491.     mario_vh_convert_color_prom,
  492.  
  493.     VIDEO_TYPE_RASTER,
  494.     0,
  495.     generic_vh_start,
  496.     generic_vh_stop,
  497.     mario_vh_screenrefresh,
  498.  
  499.     /* sound hardware */
  500.     0,0,0,0,
  501.     {
  502.         {
  503.             SOUND_AY8910,
  504.             &ay8910_interface
  505.         }
  506.     }
  507. };
  508.  
  509.  
  510.  
  511. /***************************************************************************
  512.  
  513.   Game driver(s)
  514.  
  515. ***************************************************************************/
  516.  
  517. ROM_START( mario )
  518.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  519.     ROM_LOAD( "mario.7f",     0x0000, 0x2000, 0xc0c6e014 )
  520.     ROM_LOAD( "mario.7e",     0x2000, 0x2000, 0x116b3856 )
  521.     ROM_LOAD( "mario.7d",     0x4000, 0x2000, 0xdcceb6c1 )
  522.     ROM_LOAD( "mario.7c",     0xf000, 0x1000, 0x4a63d96b )
  523.  
  524.     ROM_REGION( 0x1000, REGION_CPU2 )    /* sound */
  525.     ROM_LOAD( "tma1c-a.6k",   0x0000, 0x1000, 0x06b9ff85 )
  526.  
  527.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  528.     ROM_LOAD( "mario.3f",     0x0000, 0x1000, 0x28b0c42c )
  529.     ROM_LOAD( "mario.3j",     0x1000, 0x1000, 0x0c8cc04d )
  530.  
  531.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  532.     ROM_LOAD( "mario.7m",     0x0000, 0x1000, 0x22b7372e )
  533.     ROM_LOAD( "mario.7n",     0x1000, 0x1000, 0x4f3a1f47 )
  534.     ROM_LOAD( "mario.7p",     0x2000, 0x1000, 0x56be6ccd )
  535.     ROM_LOAD( "mario.7s",     0x3000, 0x1000, 0x56f1d613 )
  536.     ROM_LOAD( "mario.7t",     0x4000, 0x1000, 0x641f0008 )
  537.     ROM_LOAD( "mario.7u",     0x5000, 0x1000, 0x7baf5309 )
  538.  
  539.     ROM_REGION( 0x0200, REGION_PROMS )
  540.     ROM_LOAD( "mario.4p",     0x0000, 0x0200, 0xafc9bd41 )
  541. ROM_END
  542.  
  543. ROM_START( mariojp )
  544.     ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
  545.     ROM_LOAD( "tma1c-a1.7f",  0x0000, 0x2000, 0xb64b6330 )
  546.     ROM_LOAD( "tma1c-a2.7e",  0x2000, 0x2000, 0x290c4977 )
  547.     ROM_LOAD( "tma1c-a1.7d",  0x4000, 0x2000, 0xf8575f31 )
  548.     ROM_LOAD( "tma1c-a2.7c",  0xf000, 0x1000, 0xa3c11e9e )
  549.  
  550.     ROM_REGION( 0x1000, REGION_CPU2 )    /* sound */
  551.     ROM_LOAD( "tma1c-a.6k",   0x0000, 0x1000, 0x06b9ff85 )
  552.  
  553.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  554.     ROM_LOAD( "tma1v-a.3f",   0x0000, 0x1000, 0xadf49ee0 )
  555.     ROM_LOAD( "tma1v-a.3j",   0x1000, 0x1000, 0xa5318f2d )
  556.  
  557.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  558.     ROM_LOAD( "tma1v-a.7m",   0x0000, 0x1000, 0x186762f8 )
  559.     ROM_LOAD( "tma1v-a.7n",   0x1000, 0x1000, 0xe0e08bba )
  560.     ROM_LOAD( "tma1v-a.7p",   0x2000, 0x1000, 0x7b27c8c1 )
  561.     ROM_LOAD( "tma1v-a.7s",   0x3000, 0x1000, 0x912ba80a )
  562.     ROM_LOAD( "tma1v-a.7t",   0x4000, 0x1000, 0x5cbb92a5 )
  563.     ROM_LOAD( "tma1v-a.7u",   0x5000, 0x1000, 0x13afb9ed )
  564.  
  565.     ROM_REGION( 0x0200, REGION_PROMS )
  566.     ROM_LOAD( "mario.4p",     0x0000, 0x0200, 0xafc9bd41 )
  567. ROM_END
  568.  
  569. ROM_START( masao )
  570.     ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
  571.     ROM_LOAD( "masao-4.rom",  0x0000, 0x2000, 0x07a75745 )
  572.     ROM_LOAD( "masao-3.rom",  0x2000, 0x2000, 0x55c629b6 )
  573.     ROM_LOAD( "masao-2.rom",  0x4000, 0x2000, 0x42e85240 )
  574.     ROM_LOAD( "masao-1.rom",  0xf000, 0x1000, 0xb2817af9 )
  575.  
  576.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for sound */
  577.     ROM_LOAD( "masao-5.rom",  0x0000, 0x1000, 0xbd437198 )
  578.  
  579.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  580.     ROM_LOAD( "masao-6.rom",  0x0000, 0x1000, 0x1c9e0be2 )
  581.     ROM_LOAD( "masao-7.rom",  0x1000, 0x1000, 0x747c1349 )
  582.  
  583.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  584.     ROM_LOAD( "tma1v-a.7m",   0x0000, 0x1000, 0x186762f8 )
  585.     ROM_LOAD( "masao-9.rom",  0x1000, 0x1000, 0x50be3918 )
  586.     ROM_LOAD( "mario.7p",     0x2000, 0x1000, 0x56be6ccd )
  587.     ROM_LOAD( "tma1v-a.7s",   0x3000, 0x1000, 0x912ba80a )
  588.     ROM_LOAD( "tma1v-a.7t",   0x4000, 0x1000, 0x5cbb92a5 )
  589.     ROM_LOAD( "tma1v-a.7u",   0x5000, 0x1000, 0x13afb9ed )
  590.  
  591.     ROM_REGION( 0x0200, REGION_PROMS )
  592.     ROM_LOAD( "mario.4p",     0x0000, 0x0200, 0xafc9bd41 )
  593. ROM_END
  594.  
  595.  
  596.  
  597. GAME( 1983, mario,   0,     mario, mario,   0, ROT180, "Nintendo of America", "Mario Bros. (US)" )
  598. GAME( 1983, mariojp, mario, mario, mariojp, 0, ROT180, "Nintendo", "Mario Bros. (Japan)" )
  599. GAME( 1983, masao,   mario, masao, mario,   0, ROT180, "bootleg", "Masao" )
  600.